#include <StateMachine.h>

StateMachine::StateMachine()
{
	m_currentState = NULL;
}

const StrongStatePtr& StateMachine::GetState()
{
	return m_currentState;
}

void StateMachine::ChangeState(StrongStatePtr newState)
{
	if (m_currentState)
		m_currentState->VExit(newState);

	if (newState)
		newState->VEnter(m_currentState);

	m_currentState = newState;
}

void StateMachine::ExecuteState()
{
	if(m_currentState)
		m_currentState->VExecute();
}